<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态绑定 class 三目运算符语法</title>
    <style>
        .textdecorated {
            text-decoration: underline;
        }

        .colordecorated {
            color: red;
        }
    </style>
</head>
<body>
<div id="app">
    <h1 v-bind:class="true?'textdecorated':'colordecorated'">Hello, World</h1>
    <h1 v-bind:class="false?'textdecorated':'colordecorated'">Hello, World</h1>

    <h1 v-bind:class="abc?'textdecorated':'colordecorated'">Hello, World</h1>
    <h1 v-bind:class="abc?isColorDecorated:isTextDecorated">Hello, World</h1>
</div>

<script type="module">

    import {createApp} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            let abc = true
            let isColorDecorated = "colordecorated"
            let isTextDecorated = "textdecorated"
            return {
                abc,
                isColorDecorated,
                isTextDecorated,
            }
        }
    })

    app.mount("#app")
</script>
</body>
</html>